package com;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.dao.CategroryDao;
import com.vo.*;


public class CategroryServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;utf-8");
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		CategroryDao dao = new CategroryDao();
		
		try {
			List<Category> list = dao.getAll();
			HttpSession session = request.getSession();
			session.setAttribute("dataall", list);
			//request.setAttribute("dataall", list);
			request.getRequestDispatcher("manage/productClass.jsp").forward(request, response);
			for(int t=0;t<list.size();t++){
				Category category = list.get(t);
				System.out.println("--"+category.getEpc_name());
				
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
			doGet(request, response);
	}

}
